﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IBLL;
using BLL;
using Model;
using Comment;

namespace Lian_AiXiou
{
    public partial class DengLu : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if (Page.IsValid) {
                IBLLTBLogins bLLTB = new BLLTBLogins();
                OperResult<TBLogins> tB = bLLTB.Select(txt_mi.Text,txt_yong.Text);
                OperResult<TBLogins> op = new OperResult<TBLogins>();
                if (tB.StatusCode == op.StatusCode) {
                    int id = tB.ReadResult().Id;
                    IBLLTBUsers users = new BLLTBUsers();
                    IdentityManager.SaveUser(users.SelectBLL(id).Result);
                    ClientScript.RegisterStartupScript(GetType(),"aa", "alert('登陆成功');location.href='WoDe.aspx';", true);
                }
                ClientScript.RegisterStartupScript(GetType(),"aa",$"alert('{tB.Message}')",true);
            }
        }
    }
}